extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "圣舞麒麟"                   # 角色的名称
	attCoe.atkRan = 3                 # 攻击距离
	attCoe.maxHp = 5                  # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 3                    # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 8                 # 魔法攻击（每点代表13.7）
	attCoe.def = 4                    # 物理防御（每点代表15）
	attCoe.mgiDef = 4                 # 魔法防御（每点代表16.6）
	atkEff = "atk_dang" 
	xb = "王"
	lv = 4   
	addSkillTxt("[倾心]我方场上有圣王麒麟时，技能获得额外效果")
	addSkillTxt("[麟珍鬼邪]铜锣一响，黄金万两，攻击敌方单体造成200%王系魔法伤害，削弱目标双攻100点，持续3秒\n提升自身魔攻10%，最高至60%并获得一个<铜锣印记>[CD:12]")
	addSkillTxt("[五色凝光]舞动五色凝光，提升自身法穿30%6秒且提升魔防10%，最高至60%，倾心时<舞麟>[CD:9]")
	addSkillTxt("[怒麟昂首]怒麟昂首吐火球，对敌方单体造成120%王系魔法伤害，倾心时<哼！>[CD:6]")
	addSkillTxt("[color=#FFFF00][承天之佑][/color]:[color=#FFCC22]攻击敌方全体，造成210%王系魔法伤害，提升自身30%伤害5秒倾心时，<我、我才不是帮你呢！>[CD:17][/color]")
	addCdSkill("qlgz",12)
	addCdSkill("wsng",9)
	addCdSkill("qlas",6)
	addCdSkill("ctzy",17)

func _onBattleStart():
	._onBattleStart()
	tl = 0
	ql = 0
	for i in getAllChas(2):
		if i.chaName.find("圣王麒麟") > -1:
			ql = 1

var ql = 0
var tl = 0
func _castCdSkill(id):
	._castCdSkill(id)
	if id == "qlgz":
		if tl >= 1:
			var chas = getAllChas(1)
			var b = hasBuff("mogong1")
			var eff = sys.newEff("numHit", position, false, 1)
			eff.setText("麟珍鬼邪", "#FF0099")
			eff.anim.set_speed_scale(0.2)
			typeHurtCha(aiCha,att.mgiAtk*2,Chara.HurtType.MGI,Chara.AtkType.SKILL)
			aiCha.addBuff(qlgz1.new(3))
			if b == null:
				addBuff(bf.mogong1.new())
			elif b.att.mgiAtkL < 0.6:
				b.att.mgiAtkL += 0.1
			tl -= 1 
			for i in chas:
				typeHurtCha(i,att.mgiAtk*0.8,Chara.HurtType.MGI,Chara.AtkType.SKILL)
		else:
			var chas = getAllChas(1)
			var b = hasBuff("mogong1")
			var eff = sys.newEff("numHit", position, false, 1)
			eff.setText("麟珍鬼邪", "#FF0099")
			eff.anim.set_speed_scale(0.2)
			typeHurtCha(aiCha,att.mgiAtk*2,Chara.HurtType.MGI,Chara.AtkType.SKILL)
			aiCha.addBuff(qlgz1.new(3))
			if b == null:
				addBuff(bf.mogong1.new())
			elif b.att.mgiAtkL < 0.6:
				b.att.mgiAtkL += 0.1
			tl += 1
	if id == "wsng":
		var chas = getAllChas(2)
		for i in chas:
			if ql == 1:
				var eff = sys.newEff("numHit", position, false, 1)
				eff.setText("舞色凝光", "#FF0099")
				eff.anim.set_speed_scale(0.2)
				var b = hasBuff("mofang1")
				var b1 = hasBuff("mogong1")
				addBuff(bf.fachuan.new(6))
				if b == null:
					addBuff(bf.mokang1.new())
				elif b.att.mgiDefL < 0.6:
					b.att.mgiDefL += 0.1
				if b1 == null:
					addBuff(bf.mogong1.new())
				elif b1.att.mgiAtkL < 0.6:
					b1.att.mgiAtkL += 0.1
			else:
				var eff = sys.newEff("numHit", position, false, 1)
				eff.setText("五色凝光", "#FF0099")
				eff.anim.set_speed_scale(0.2)
				var b = hasBuff("mofang1")
				addBuff(bf.fachuan.new(6))
				if b == null:
					addBuff(bf.mokang1.new())
				elif b.att.mgiDefL < 0.6:
					b.att.mgiDefL += 0.1
	if id == "qlas":
		if ql == 1:
			var eff = sys.newEff("numHit", position, false, 1)
			eff.setText("傲娇抬头", "#FF0099")
			eff.anim.set_speed_scale(0.2)
			var chas = getAllChas(2)
			for i in chas:
				typeHurtCha(aiCha,att.mgiAtk*1.2,Chara.HurtType.MGI,Chara.AtkType.SKILL)
				i.addBuff(taitou.new(3))
				aiCha.addBuff(bf.zhuoshao.new(5))
				aiCha.addBuff(bf.pojia.new(5))
		else:
			var eff = sys.newEff("numHit", position, false, 1)
			eff.setText("怒麟昂首", "#FF0099")
			eff.anim.set_speed_scale(0.2)
			var chas = getAllChas(2)
			for i in chas:
				typeHurtCha(aiCha,att.mgiAtk*1.2,Chara.HurtType.MGI,Chara.AtkType.SKILL)
				i.addBuff(taitou.new(3))
	if id == "ctzy":
		var chas = getAllChas(1)
		var cha = getAllChas(2)
		if ql == 1:
			var eff = sys.newEff("numHit", position, false, 1)
			eff.setText("我可不是在帮你", "#FF0099")
			eff.anim.set_speed_scale(0.2)
			for i in chas:
				typeHurtCha(i,att.mgiAtk*2.1,Chara.HurtType.MGI,Chara.AtkType.SKILL)
				addBuff(chengtian.new(5))
				for j in cha:
					j.changeShield((att.atk+att.mgiAtk)*1)
		else:
			var eff = sys.newEff("numHit", position, false, 1)
			eff.setText("承天之佑", "#FF0099")
			eff.anim.set_speed_scale(0.2)
			for i in chas:
				typeHurtCha(i,att.mgiAtk*2.1,Chara.HurtType.MGI,Chara.AtkType.SKILL)
				addBuff(chengtian.new(5))

class chengtian:
	extends Buff
	func _init(lv = 1):
		attInit()
		var dispelable = false
		isNegetive=true
		life = lv
		id = "chengtian"	
		att.atkR += 0.3

class taitou:
	extends Buff
	func _init(lv = 1):
		attInit()
		var dispelable = false
		isNegetive=true
		life = lv
		id = "taitou"	
		att.dod += 0.2

class qlgz1:
	extends Buff
	func _init(lv = 1):
		attInit()
		var dispelable = false
		isNegetive=true
		life = lv
		id = "qlgz1"	
		att.atk -= 100
		att.mgiAtk -= 100


